<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>banner页面</title>

    <!--ios7 toggle切换-->
    <link rel="stylesheet" type="text/css" href="/static/js/ios-switch/switchery.css" />

    <!--data table-->
    <link rel="stylesheet" href="/static/js/data-tables/DT_bootstrap.css" />

    <link href="/static/css/page.css" rel="stylesheet">

    <link href="/static/css/style.css" rel="stylesheet">
    <link href="/static/css/style-responsive.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="/static/js/html5shiv.js"></script>
    <script src="/static/js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="sticky-header">

<section>
    <!-- left side start-->
    <div class="left-side sticky-left-side">

        <!--logo and iconic logo start-->
        <div class="logo">
            <a href="index.html"><img src="/static/images/logo.png" alt=""></a>
        </div>

        <div class="logo-icon text-center">
            <a href="index.html"><img src="/static/images/logo_icon.png" alt=""></a>
        </div>
        <!--logo and iconic logo end-->


        <div class="left-side-inner">

            <!-- visible to small devices only -->
            <div class="visible-xs hidden-sm hidden-md hidden-lg">
                <div class="media logged-user">
                    <img alt="" src="/static/images/photos/user-avatar.png" class="media-object">
                    <div class="media-body">
                        <h4><a href="#">John Doe</a></h4>
                        <span>"Hello There..."</span>
                    </div>
                </div>

                <h5 class="left-nav-title">Account Information</h5>
                <ul class="nav nav-pills nav-stacked custom-nav">
                    <li><a href="#"><i class="fa fa-user"></i> <span>Profile</span></a></li>
                    <li><a href="#"><i class="fa fa-cog"></i> <span>Settings</span></a></li>
                    <li><a href="#"><i class="fa fa-sign-out"></i> <span>Sign Out</span></a></li>
                </ul>
            </div>

            <!--sidebar nav start-->
            <ul class="nav nav-pills nav-stacked custom-nav">
                <li class="menu-list"><a href="/commerce/api/v2/index"><i class="fa fa-home"></i> <span>首页</span></a>
                    <ul class="sub-menu-list">
                        <li class="active"><a href="/commerce/api/v2/index">指示板</a></li>
                    </ul>
                </li>
                <li class="active"><a href="/commerce/api/v2/banner/list"><i class="fa fa-gift"></i> <span>banner</span></a></li>
                <li class="menu-list"><a href=""><i class="fa fa-th-list"></i> <span>分类&品牌</span></a>
                    <ul class="sub-menu-list">
                        <li><a href="/commerce/api/v2/category/list">分类</a></li>
                        <li><a href="/commerce/api/v2/brand/list">品牌</a></li>
                    </ul>
                </li>
                <li class="menu-list"><a href=""><i class="fa fa-apple"></i> <span>商品</span></a>
                    <ul class="sub-menu-list">
                        <li class="active"><a href="/commerce/api/v2/goods/list">商品</a></li>
                        <li><a href="/commerce/api/v2/sku/list">商品sku</a></li>
                        <li><a href="/commerce/api/v2/inventory/list">商品sku库存销量</a></li>
                        <li><a href="/commerce/api/v2/goodsAttr/list">商品属性</a></li>
                    </ul>
                </li>
                <li><a href="/commerce/api/v2/order/list"><i class="fa fa-btc"></i> <span>订单</span></a></li>
                <li class="menu-list"><a href=""><i class="fa fa-user"></i> <span>用户</span></a>
                    <ul class="sub-menu-list">
                        <li class="active"><a href="/commerce/api/v2/user/list">商城客户</a></li>
                        <li><a href="/commerce/api/v2/comment/list">用户评价</a></li>
                        <li><a href="/commerce/api/v2/admin/list">后台管理用户</a></li>
                    </ul>
                </li>
                <li class="menu-list"><a href=""><i class="fa fa-hand-o-up"></i> <span>帮助中心</span></a>
                    <ul class="sub-menu-list">
                        <li><a href="/commerce/api/v2/help/list">问题类型</a></li>
                        <li><a href="/commerce/api/v2/help/qaList">问答</a></li>
                    </ul>
                </li>
                <li><a href="/commerce/api/v2/feedback/list"><i class="fa fa-comments-o"></i> <span>意见反馈</span></a></li>
            </ul>
            <!--sidebar nav end-->

        </div>
    </div>
    <!-- left side end-->

    <!-- main content start-->
    <div class="main-content" >

        <!-- header section start-->
        <div class="header-section">

            <!--toggle button start-->
            <a class="toggle-btn"><i class="fa fa-bars"></i></a>
            <!--toggle button end-->

            <!--notification menu start -->
            <div class="menu-right">
                <ul class="notification-menu">
                    <li>
                        <a href="#" class="btn btn-default dropdown-toggle info-number" data-toggle="dropdown">
                            <i class="fa fa-tasks"></i>
                            <span class="badge">8</span>
                        </a>
                        <div class="dropdown-menu dropdown-menu-head pull-right">
                            <h5 class="title">You have 8 pending task</h5>
                            <ul class="dropdown-list user-list">
                                <li class="new">
                                    <a href="#">
                                        <div class="task-info">
                                            <div>Database update</div>
                                        </div>
                                        <div class="progress progress-striped">
                                            <div style="width: 40%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="40" role="progressbar" class="progress-bar progress-bar-warning">
                                                <span class="">40%</span>
                                            </div>
                                        </div>
                                    </a>
                                </li>
                                <li class="new">
                                    <a href="#">
                                        <div class="task-info">
                                            <div>Dashboard done</div>
                                        </div>
                                        <div class="progress progress-striped">
                                            <div style="width: 90%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="90" role="progressbar" class="progress-bar progress-bar-success">
                                                <span class="">90%</span>
                                            </div>
                                        </div>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <div class="task-info">
                                            <div>Web Development</div>
                                        </div>
                                        <div class="progress progress-striped">
                                            <div style="width: 66%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="66" role="progressbar" class="progress-bar progress-bar-info">
                                                <span class="">66% </span>
                                            </div>
                                        </div>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <div class="task-info">
                                            <div>Mobile App</div>
                                        </div>
                                        <div class="progress progress-striped">
                                            <div style="width: 33%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="33" role="progressbar" class="progress-bar progress-bar-danger">
                                                <span class="">33% </span>
                                            </div>
                                        </div>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <div class="task-info">
                                            <div>Issues fixed</div>
                                        </div>
                                        <div class="progress progress-striped">
                                            <div style="width: 80%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="80" role="progressbar" class="progress-bar">
                                                <span class="">80% </span>
                                            </div>
                                        </div>
                                    </a>
                                </li>
                                <li class="new"><a href="">See All Pending Task</a></li>
                            </ul>
                        </div>
                    </li>
                    <li>
                        <a href="#" class="btn btn-default dropdown-toggle info-number" data-toggle="dropdown">
                            <i class="fa fa-envelope-o"></i>
                            <span class="badge">5</span>
                        </a>
                        <div class="dropdown-menu dropdown-menu-head pull-right">
                            <h5 class="title">You have 5 Mails </h5>
                            <ul class="dropdown-list normal-list">
                                <li class="new">
                                    <a href="">
                                        <span class="thumb"><img src="/static/images/photos/user1.png" alt="" /></span>
                                        <span class="desc">
                                          <span class="name">John Doe <span class="badge badge-success">new</span></span>
                                          <span class="msg">Lorem ipsum dolor sit amet...</span>
                                        </span>
                                    </a>
                                </li>
                                <li>
                                    <a href="">
                                        <span class="thumb"><img src="/static/images/photos/user2.png" alt="" /></span>
                                        <span class="desc">
                                          <span class="name">Jonathan Smith</span>
                                          <span class="msg">Lorem ipsum dolor sit amet...</span>
                                        </span>
                                    </a>
                                </li>
                                <li>
                                    <a href="">
                                        <span class="thumb"><img src="/static/images/photos/user3.png" alt="" /></span>
                                        <span class="desc">
                                          <span class="name">Jane Doe</span>
                                          <span class="msg">Lorem ipsum dolor sit amet...</span>
                                        </span>
                                    </a>
                                </li>
                                <li>
                                    <a href="">
                                        <span class="thumb"><img src="/static/images/photos/user4.png" alt="" /></span>
                                        <span class="desc">
                                          <span class="name">Mark Henry</span>
                                          <span class="msg">Lorem ipsum dolor sit amet...</span>
                                        </span>
                                    </a>
                                </li>
                                <li>
                                    <a href="">
                                        <span class="thumb"><img src="/static/images/photos/user5.png" alt="" /></span>
                                        <span class="desc">
                                          <span class="name">Jim Doe</span>
                                          <span class="msg">Lorem ipsum dolor sit amet...</span>
                                        </span>
                                    </a>
                                </li>
                                <li class="new"><a href="">Read All Mails</a></li>
                            </ul>
                        </div>
                    </li>
                    <li>
                        <a href="#" class="btn btn-default dropdown-toggle info-number" data-toggle="dropdown">
                            <i class="fa fa-bell-o"></i>
                            <span class="badge">4</span>
                        </a>
                        <div class="dropdown-menu dropdown-menu-head pull-right">
                            <h5 class="title">Notifications</h5>
                            <ul class="dropdown-list normal-list">
                                <li class="new">
                                    <a href="">
                                        <span class="label label-danger"><i class="fa fa-bolt"></i></span>
                                        <span class="name">Server #1 overloaded.  </span>
                                        <em class="small">34 mins</em>
                                    </a>
                                </li>
                                <li class="new">
                                    <a href="">
                                        <span class="label label-danger"><i class="fa fa-bolt"></i></span>
                                        <span class="name">Server #3 overloaded.  </span>
                                        <em class="small">1 hrs</em>
                                    </a>
                                </li>
                                <li class="new">
                                    <a href="">
                                        <span class="label label-danger"><i class="fa fa-bolt"></i></span>
                                        <span class="name">Server #5 overloaded.  </span>
                                        <em class="small">4 hrs</em>
                                    </a>
                                </li>
                                <li class="new">
                                    <a href="">
                                        <span class="label label-danger"><i class="fa fa-bolt"></i></span>
                                        <span class="name">Server #31 overloaded.  </span>
                                        <em class="small">4 hrs</em>
                                    </a>
                                </li>
                                <li class="new"><a href="">See All Notifications</a></li>
                            </ul>
                        </div>
                    </li>
                    <li>
                        <a href="#" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            <img src="/static/images/photos/user-avatar.png" alt="" />
                            管理员
                            <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-usermenu pull-right">
                            <li><a href="#"><i class="fa fa-user"></i>  Profile</a></li>
                            <li><a href="#"><i class="fa fa-cog"></i>  Settings</a></li>
                            <li>
                                <form action="/logout" method="post">
                                    <button class="fa fa-sign-out btn btn-warning" type="submit">登 出</button>
                                </form>
                            </li>
                        </ul>
                    </li>

                </ul>
            </div>
            <!--notification menu end -->

        </div>
        <!-- header section end-->

        <!-- page heading start-->
        <div class="page-heading">
            <h3>
                banner页面
            </h3>
        </div>
        <!-- page heading end-->

        <!--body wrapper start-->
        <div class="wrapper">
            <div class="row">
                <div class="col-sm-12">
                    <section class="panel">
                        <div class="panel-body">
                            <div class="adv-table editable-table ">
                                <div class="clearfix">
                                    <div class="btn-group">
                                        <button id="addBannerId" class="btn btn-primary">
                                            新增  <i class="fa fa-plus"></i>
                                        </button>
                                    </div>
<!--                                    <div class="btn-group pull-right">-->
<!--                                        <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">工具 <i class="fa fa-angle-down"></i>-->
<!--                                        </button>-->
<!--                                        <ul class="dropdown-menu pull-right">-->
<!--                                            <li><a href="#">打印</a></li>-->
<!--                                            <li><a href="#">保存为pdf</a></li>-->
<!--                                            <li><a href="#">导出为excel</a></li>-->
<!--                                        </ul>-->
<!--                                    </div>-->
                                </div>
                                <div class="space15"></div>
                                <table class="table table-striped table-hover table-bordered" id="editable-sample">
                                    <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>链接</th>
                                        <th>图片</th>
                                        <th>优先级</th>
                                        <th>状态</th>
                                        <th>创建时间</th>
                                        <th>编辑</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {{range .List}}
                                    <tr class="">
                                        <td>{{.Id}}</td>
                                        <td>{{.Link}}</td>
                                        <td><a href="{{.ImgUrl}}" target="_blank"><img width="90px" height="50px" src="{{.ImgUrl}}" alt=""></a></td>
                                        <td>{{.Priority}}</td>
                                        <td><div class="slide-toggle" idVal="{{.Id}}">
                                            {{if eq .IsValid 1}}
                                            <div><input type="checkbox" class="js-switch" checked/></div>
                                            {{else}}
                                            <div><input type="checkbox" class="js-switch"/></div>
                                            {{end}}
                                        </div></td>
                                        <td class="center">{{.CreatedTimeStr}}</td>
                                        <td><a href="/commerce/api/v2/banner/updateUI?id={{.Id}}">修改</a></td>
                                    </tr>
                                    {{end}}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
            <div id="page_nav">
                {{if .HasPrev}}
                <a href="{{.Url}}&pageNo=1">首页</a>
                <a href="{{.Url}}&pageNo={{.GetPrevPage}}">上一页</a>
                {{end}}
                当前是第{{.PageNo}}页，共<span id="totalPages">{{.TotalPages}} </span>页，共{{.TotalRecords}}条记录
                {{if .HasNext}}
                <a href="{{.Url}}&pageNo={{.GetNextPage}}">下一页</a>
                <a href="{{.Url}}&pageNo={{.TotalPages}}">末页</a>
                {{end}}
                到第<input value="{{.PageNo}}" name="pn" id="pn_input"/>页
                <input type="button" value="确定" id="sub">
            </div>
        </div>
        <!--body wrapper end-->

        <!--footer section start-->
        <footer>
            由大国妮子提供
        </footer>
        <!--footer section end-->


    </div>
    <!-- main content end-->
</section>

<!-- Placed js at the end of the document so the pages load faster -->
<script src="/static/js/jquery-1.10.2.min.js"></script>
<script src="/static/js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="/static/js/jquery-migrate-1.2.1.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/modernizr.min.js"></script>

<!--ios7 toggle切换-->
<script src="/static/js/ios-switch/switchery.js" ></script>
<script src="/static/js/ios-switch/ios-init.js" ></script>

<!--common scripts for all pages-->
<script src="/static/js/scripts.js"></script>
<script>
    $("#addBannerId").click(function () {
        window.location.href = "/commerce/api/v2/banner/addUI";
    });
    //给确定按钮绑定单击事件
    $("#sub").click(function(){
        //获取输入的页码
        var pageNo = $("#pn_input").val();
        var totalPages = $("#totalPages").text();
        if (pageNo <= 0 || pageNo > totalPages){
            alert("输入页码有误！");
            return false;
        }else {
            location = "{{.Url}}&pageNo=" + pageNo
        }
    });

    $(".slide-toggle").click(function () {

        var id = $(this).attr("idVal");

        var status = 0;
        if ($($(this).find("input[type=checkbox]")[0]).attr('checked')) {
            status = 1;
        }
        $.post("/commerce/api/v2/banner/updateStatus?id="+id+"&status="+status, function (data) {
            window.location.reload();
        });
    });

</script>
</body>
</html>
